<div id="comment-list">
    <ul class="timeline timeline-alt">
        <!--{iCMS:comment:list loop="true" page="true" row="2" userid="$ME.uid"}-->
        <li class="timeline-event" data-id="<!--{$comment_list.id}-->" data-param="<!--{$comment_list.param|json_param}-->">
            <div class="timeline-event-icon bg-info">
                <!--{$comment_list.apps.title}-->
            </div>
            <div class="timeline-event-block block invisible" data-toggle="appear">
                <div class="block-header block-header-default">
                    <h3 class="block-title">
                        <a href="<!--{$comment_list.content_url}-->"><!--{$comment_list.target_title}--></a>
                    </h3>
                    <div class="block-options">
                        <div class="timeline-event-time block-options-item font-size-sm font-w600"></div>
                        <a class="btn btn-alt-primary btn-sm" href="<!--{$comment_list.content_url}-->" target="_blank">查看原文</a>
                    </div>
                </div>
                <div class="block-content">
                    <div class="media font-size-sm">
                        <div class="media-body">
                            <p>
                                <!--{if $comment_list.status=="0"}-->
                                <span class="badge badge-warning">未审核</span>
                                <!--{/if}-->
                                <!--{$comment_list.content|nl2br}-->
                                <hr class="m-1"/>
                                <span class="mr-2"><!--{$comment_list.create_time|date:'Y-m-d H:i:s')}--></span>
                                <span class="mr-2">
                                    <i class="fa fa-fw fa-thumbs-up text-muted"></i>
                                    <!--{$comment_list.up}-->
                                </span>
                                <span class="mr-2">
                                    <i class="fa fa-fw fa-thumbs-down text-muted"></i>
                                    <!--{$comment_list.down}-->
                                </span>
                                <!--{if $comment_list.reply_count}-->
                                <a i="event:comment:reply:all" class="text-dark mr-2" href="javascript:;" >
                                    <i class="fa fa-fw fa-comment-dots text-muted"></i>
                                    <!--{$comment_list.reply_count}-->
                                    条回复
                                </a>
                                <!--{/if}-->
                                <a i="event:comment:delete" class="text-dark mr-2" href="<!--{iCMS:route url='CommentUser'}-->">
                                    <i class="fa fa-fw fa-times text-muted"></i>
                                    删除
                                </a>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </li>
        <!--{/iCMS}-->
    </ul>
    <nav aria-label="Page navigation">
        <ul class="pagination push">
            <!--{$iCMS.PAGE.NAV}-->
        </ul>
    </nav>
</div>

<script>
    function event_comment_delete(self, vars, e) {
        if (!confirm("确定要删除")) {
            return false;
        }
        var $self = $(self);
        var $wrap = $self.closest("[data-id]");
        var $id = $wrap.data("id");
        var api = $self.attr("href");
        var data = {
            action:'delete',
            id: $id
        };
        iCMS.request
            .post(api, data)
            .then(function (json) {
                if (json.code) {
                    iCMS.notify.success(json.message);
                    $wrap.remove();
                } else {
                    iCMS.notify.error(json.message, 3000);
                }
            })
            .catch(function (error) {
                console.log(error);
            });
    }
</script>